import { createPool } from "mysql";
// 配置对象
let pool = createPool({
  host: "127.0.0.1",
  user: "root",
  password: "111111",
  database: "nodejssql",
})

export default (sqlcontent, parameterArr)=>new Promise((resolve, reject) => {
  pool.getConnection((err, connection)=>{
    if(err){
      reject(err)
    }else{
      connection.query(sqlcontent, parameterArr,(err, data)=>{
        if(err){
          reject(err)
        }else{
          resolve({connection,data})
        }
      })
    }
  })
})